package m.olive.graph.controller;

import m.framework.controller.BaseController;
import m.framework.controller.Task;
import m.framework.dao.selector.PageRecord;
import m.framework.dao.selector.Query;
import m.olive.graph.model.RrdGraph;
import m.olive.graph.service.RrdGraphService;

import org.springframework.stereotype.Controller;

@Controller
@Task("监控图")
public class RrdGraphController extends BaseController {
	
	@Task("监控图首页")
	public RrdGraph index(RrdGraph rrdGraph) {
		return rrdGraph;
	}
	
	@Task("准备新增监控图")
	public RrdGraph prepareInsert(RrdGraph rrdGraph) {
		return rrdGraph;
	}
	
	@Task("准备修改监控图")
	public RrdGraph prepareUpdate(RrdGraph rrdGraph) {
		return this.defultService().get(RrdGraph.class, rrdGraph.getRrdGraphId());
	}

	@Task("新增监控图")
	public RrdGraph insert(RrdGraph rrdGraph) {
		RrdGraphService rrdGraphService=this.getService(RrdGraphService.class);
		rrdGraph.setPk();
		rrdGraphService.insert(rrdGraph);
		return rrdGraph;
	}
	
	@Task("删除监控图")
	public RrdGraph delete(RrdGraph rrdGraph) {
		RrdGraphService rrdGraphService=this.getService(RrdGraphService.class);
		rrdGraphService.delete(rrdGraph);
		return rrdGraph;
	}
	
	@Task("修改监控图")
	public RrdGraph update(RrdGraph rrdGraph) {
		RrdGraphService rrdGraphService=this.getService(RrdGraphService.class);
		rrdGraphService.updateFull(rrdGraph);
		return rrdGraph;
	}

	@Task("查询监控图")
	public PageRecord query(Query<RrdGraph> query,PageRecord pageRecord){
		return this.defultService().queryPage(query, 1, pageRecord.getRowsPerPage());
	}
	
	@Task("翻页查询监控图")
	public PageRecord queryContinue(PageRecord pageRecord){
		return super.queryContinue(pageRecord);
	}

}
